<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //创建set集合
      let data = new Set()

      data.add(100)
      data.add(200)
      data.add(100)
      data.add(300)
      for (let item of data) {
        console.log(item)
      }

      let exits = data.has(200)
      console.log(exits) //true
      let exits2 = data.has(500)
      console.log(exits2) //false

      //删除数据
      data.delete(100)
      let exits3 = data.has(100)
      console.log(exits3)

      for (let k of data.keys()) {
        console.log(k)
      }

      for (let v of data.values()) {
        console.log(v)
      }

      for (let entry of data.entries()) {
        console.log(entry[0], entry[1])
      }
    </script>
  </body>
</html>
